-
Notifications
You must be signed in to change notification settings - Fork 60
TNTP-3334: IPROTO_IS_SYNC support for begin/commit #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5f1d4dc
to
4357337
Compare
4357337
to
c74d03f
Compare
->
|
8892063
to
f8f4d2d
Compare
example_test.go
Outdated
conn := exampleConnect(dialer, opts) | ||
defer conn.Close() | ||
|
||
// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment should end with a dot.
// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0 | |
// Tarantool supports IS_SYNC flag for BeginRequest since version 3.1.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
example_test.go
Outdated
conn := exampleConnect(dialer, opts) | ||
defer conn.Close() | ||
|
||
// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0q | |
// Tarantool supports IS_SYNC flag for CommitRequest since version 3.1.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
example_test.go
Outdated
return | ||
} | ||
|
||
// Begin transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Begin transaction | |
// Begin transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
example_test.go
Outdated
return | ||
} | ||
|
||
// Insert in stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Insert in stream | |
// Insert in stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
example_test.go
Outdated
return | ||
} | ||
|
||
// Commit transaction in sync mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Commit transaction in sync mode | |
// Commit transaction in sync mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
stream.go
Outdated
baseRequest | ||
txnIsolation TxnIsolationLevel | ||
timeout time.Duration | ||
isSync *bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoud a pointer here.
isSync *bool | |
isSync bool | |
isSyncExist bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
stream.go
Outdated
@@ -137,6 +152,8 @@ func (req *BeginRequest) Context(ctx context.Context) *BeginRequest { | |||
// Commit request can not be processed out of stream. | |||
type CommitRequest struct { | |||
baseRequest | |||
|
|||
isSync *bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
dea5ad8
to
168a18a
Compare
@@ -171,8 +167,24 @@ func (req *ExecutePreparedRequest) Args(args interface{}) *ExecutePreparedReques | |||
} | |||
|
|||
// Body fills an msgpack.Encoder with the execute request body. | |||
func (req *ExecutePreparedRequest) Body(res SchemaResolver, enc *msgpack.Encoder) error { | |||
return fillExecutePrepared(enc, *req.stmt, req.args) | |||
func (req *ExecutePreparedRequest) Body(_ SchemaResolver, enc *msgpack.Encoder) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For here and all other functions.
Just a cosmetic: it would a bit better to add empty lines between blocks.
At least if we add linters from tt
they will force add such lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
prepared.go
Outdated
if err != nil { | ||
return err | ||
} | ||
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)) | |
err = enc.EncodeUint(uint64(iproto.IPROTO_STMT_ID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
prepared.go
Outdated
if err != nil { | ||
return err | ||
} | ||
err = enc.EncodeUint(uint64(req.stmt.StatementID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = enc.EncodeUint(uint64(req.stmt.StatementID)) | |
err = enc.EncodeUint(uint64(req.stmt.StatementID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
prepared.go
Outdated
if err != nil { | ||
return err | ||
} | ||
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND)) | |
err = enc.EncodeUint(uint64(iproto.IPROTO_SQL_BIND)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if err != nil { | ||
return err | ||
} | ||
return encodeSQLBind(enc, req.args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return encodeSQLBind(enc, req.args) | |
return encodeSQLBind(enc, req.args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dot is missed.
NB: all deleted tests were checking that functions passed from
constructor object to fillXXX function were passed in right order, so
removing them is not a problem
->
NB: all deleted tests were checking that functions passed from
constructor object to fillXXX function were passed in right order, so
removing them is not a problem.
NB: all deleted tests were checking that functions passed from constructor object to fillXXX function were passed in right order, so removing them is not a problem.
Part of #TNTP-3334 Closes #366
168a18a
to
57d71e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please don't forget to add a removed tests analogues in a next PR.
Implement
BeginRequest.IsSync(bool)
andCommitRequest.IsSync(bool)
.Refactor
Body
methods of all Requests, do not usefillXXX
functions.Part of TNTP-3334
Closes #366